home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / Events.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  10.3 KB  |  390 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Events.a
  3. ;
  4. ;    Contains:    Event Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    Mac OS 8
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  19. __EVENTS__ SET 1
  20.  
  21.     IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
  22.     include 'OSUtils.a'
  23.     ENDIF
  24.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  25.     include 'Quickdraw.a'
  26.     ENDIF
  27.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  28.     include 'MacTypes.a'
  29.     ENDIF
  30.  
  31.     IF ¬ TARGET_OS_MAC THEN
  32.     IF &TYPE('__ENDIAN__') = 'UNDEFINED' THEN
  33.     include 'Endian.a'
  34.     ENDIF
  35.     ENDIF
  36. ; typedef UInt16                         EventKind
  37.  
  38. ; typedef UInt16                         EventMask
  39.  
  40.  
  41. nullEvent                        EQU        0
  42. mouseDown                        EQU        1
  43. mouseUp                            EQU        2
  44. keyDown                            EQU        3
  45. keyUp                            EQU        4
  46. autoKey                            EQU        5
  47. updateEvt                        EQU        6
  48. diskEvt                            EQU        7
  49. activateEvt                        EQU        8
  50. osEvt                            EQU        15
  51. kHighLevelEvent                    EQU        23
  52.  
  53. mDownMask                        EQU        $02                    ; mouse button pressed
  54. mUpMask                            EQU        $04                    ; mouse button released
  55. keyDownMask                        EQU        $08                    ; key pressed
  56. keyUpMask                        EQU        $10                    ; key released
  57. autoKeyMask                        EQU        $20                    ; key repeatedly held down
  58. updateMask                        EQU        $40                    ; window needs updating
  59. diskMask                        EQU        $80                    ; disk inserted
  60. activMask                        EQU        $0100                ; activate/deactivate window
  61. highLevelEventMask                EQU        $0400                ; high-level events (includes AppleEvents)
  62. osMask                            EQU        $8000                ; operating system events (suspend, resume)
  63. everyEvent                        EQU        $FFFF                ; all of the above
  64.  
  65. charCodeMask                    EQU        $000000FF
  66. keyCodeMask                        EQU        $0000FF00
  67. adbAddrMask                        EQU        $00FF0000
  68. osEvtMessageMask                EQU        $FF000000
  69.  
  70.                                                             ; OS event messages.  Event (sub)code is in the high byte of the message field.
  71. mouseMovedMessage                EQU        $00FA
  72. suspendResumeMessage            EQU        $0001
  73.  
  74. resumeFlag                        EQU        1                    ; Bit 0 of message indicates resume vs suspend
  75. convertClipboardFlag            EQU        2                    ; Bit 1 in resume message indicates clipboard change
  76.  
  77. ; typedef UInt16                         EventModifiers
  78.  
  79.  
  80.                                                             ; modifiers 
  81. activeFlagBit                    EQU        0                    ; activate? (activateEvt and mouseDown)
  82. btnStateBit                        EQU        7                    ; state of button?
  83. cmdKeyBit                        EQU        8                    ; command key down?
  84. shiftKeyBit                        EQU        9                    ; shift key down?
  85. alphaLockBit                    EQU        10                    ; alpha lock down?
  86. optionKeyBit                    EQU        11                    ; option key down?
  87. controlKeyBit                    EQU        12                    ; control key down?
  88. rightShiftKeyBit                EQU        13                    ; right shift key down?
  89. rightOptionKeyBit                EQU        14                    ; right Option key down?
  90. rightControlKeyBit                EQU        15                    ; right Control key down?
  91.  
  92. activeFlag                        EQU        $01
  93. btnState                        EQU        $80
  94. cmdKey                            EQU        $0100
  95. shiftKey                        EQU        $0200
  96. alphaLock                        EQU        $0400
  97. optionKey                        EQU        $0800
  98. controlKey                        EQU        $1000
  99. rightShiftKey                    EQU        $2000
  100. rightOptionKey                    EQU        $4000
  101. rightControlKey                    EQU        $8000
  102.  
  103. kNullCharCode                    EQU        0
  104. kHomeCharCode                    EQU        1
  105. kEnterCharCode                    EQU        3
  106. kEndCharCode                    EQU        4
  107. kHelpCharCode                    EQU        5
  108. kBellCharCode                    EQU        7
  109. kBackspaceCharCode                EQU        8
  110. kTabCharCode                    EQU        9
  111. kLineFeedCharCode                EQU        10
  112. kVerticalTabCharCode            EQU        11
  113. kPageUpCharCode                    EQU        11
  114. kFormFeedCharCode                EQU        12
  115. kPageDownCharCode                EQU        12
  116. kReturnCharCode                    EQU        13
  117. kFunctionKeyCharCode            EQU        16
  118. kEscapeCharCode                    EQU        27
  119. kClearCharCode                    EQU        27
  120. kLeftArrowCharCode                EQU        28
  121. kRightArrowCharCode                EQU        29
  122. kUpArrowCharCode                EQU        30
  123. kDownArrowCharCode                EQU        31
  124. kDeleteCharCode                    EQU        127
  125. kNonBreakingSpaceCharCode        EQU        202
  126. EventRecord                RECORD 0
  127. what                     ds.w    1                ; offset: $0 (0)
  128. message                     ds.l    1                ; offset: $2 (2)
  129. when                     ds.l    1                ; offset: $6 (6)
  130. where                     ds        Point            ; offset: $A (10)
  131. modifiers                 ds.w    1                ; offset: $E (14)
  132. sizeof                     EQU *                    ; size:   $10 (16)
  133.                         ENDR
  134.  
  135. ;
  136. ; pascal void GetMouse(Point *mouseLoc)
  137. ;
  138.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  139.         _GetMouse:    OPWORD    $A972
  140.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  141.         IMPORT_CFM_FUNCTION GetMouse
  142.     ENDIF
  143.  
  144. ;
  145. ; pascal Boolean Button(void )
  146. ;
  147.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  148.         _Button:    OPWORD    $A974
  149.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  150.         IMPORT_CFM_FUNCTION Button
  151.     ENDIF
  152.  
  153. ;
  154. ; pascal Boolean StillDown(void )
  155. ;
  156.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  157.         _StillDown:    OPWORD    $A973
  158.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  159.         IMPORT_CFM_FUNCTION StillDown
  160.     ENDIF
  161.  
  162. ;
  163. ; pascal Boolean WaitMouseUp(void )
  164. ;
  165.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  166.         _WaitMouseUp:    OPWORD    $A977
  167.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  168.         IMPORT_CFM_FUNCTION WaitMouseUp
  169.     ENDIF
  170.  
  171. ;
  172. ; pascal UInt32 TickCount(void )
  173. ;
  174.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  175.         _TickCount:    OPWORD    $A975
  176.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  177.         IMPORT_CFM_FUNCTION TickCount
  178.     ENDIF
  179.  
  180. ;
  181. ; pascal UInt32 KeyTranslate(const void *transData, UInt16 keycode, UInt32 *state)
  182. ;
  183.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  184.         _KeyTranslate:    OPWORD    $A9C3
  185.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  186.         IMPORT_CFM_FUNCTION KeyTranslate
  187.     ENDIF
  188.  
  189. ;
  190. ; pascal UInt32 GetCaretTime(void)
  191. ;
  192.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  193.         Macro
  194.         _GetCaretTime         &dest=(sp)
  195.             move.l            $02F4,&dest
  196.         EndM
  197.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  198.         IMPORT_CFM_FUNCTION GetCaretTime
  199.     ENDIF
  200.  
  201.  
  202. KeyMap                    RECORD 0
  203. map                         ds.b    16                ; offset: $0 (0)
  204. sizeof                     EQU *                    ; size:   $10 (16)
  205.                         ENDR
  206. ;
  207. ; pascal void GetKeys(KeyMap theKeys)
  208. ;
  209.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  210.         _GetKeys:    OPWORD    $A976
  211.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  212.         IMPORT_CFM_FUNCTION GetKeys
  213.     ENDIF
  214.  
  215.  
  216.  
  217. ;  Obsolete event types & masks 
  218.  
  219. networkEvt                        EQU        10
  220. driverEvt                        EQU        11
  221. app1Evt                            EQU        12
  222. app2Evt                            EQU        13
  223. app3Evt                            EQU        14
  224. app4Evt                            EQU        15
  225. networkMask                        EQU        $0400
  226. driverMask                        EQU        $0800
  227. app1Mask                        EQU        $1000
  228. app2Mask                        EQU        $2000
  229. app3Mask                        EQU        $4000
  230. app4Mask                        EQU        $8000
  231. EvQEl                    RECORD 0
  232. qLink                     ds.l    1                ; offset: $0 (0)
  233. qType                     ds.w    1                ; offset: $4 (4)
  234. evtQWhat                 ds.w    1                ; offset: $6 (6)        ;  this part is identical to the EventRecord as defined above 
  235. evtQMessage                 ds.l    1                ; offset: $8 (8)
  236. evtQWhen                 ds.l    1                ; offset: $C (12)
  237. evtQWhere                 ds        Point            ; offset: $10 (16)
  238. evtQModifiers             ds.w    1                ; offset: $14 (20)
  239. sizeof                     EQU *                    ; size:   $16 (22)
  240.                         ENDR
  241. ; typedef struct EvQEl *                EvQElPtr
  242.  
  243. ; typedef GetNextEventFilterUPP         GNEFilterUPP
  244.  
  245. ;
  246. ; pascal QHdrPtr GetEvQHdr(void )
  247. ;
  248.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  249.         Macro
  250.         _GetEvQHdr            &dest=(sp)
  251.             move.l            #$0000014A,&dest
  252.         EndM
  253.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  254.         IMPORT_CFM_FUNCTION GetEvQHdr
  255.     ENDIF
  256.  
  257. ;
  258. ; pascal UInt32 GetDblTime(void)
  259. ;
  260.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  261.         Macro
  262.         _GetDblTime           &dest=(sp)
  263.             move.l            $02F0,&dest
  264.         EndM
  265.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  266.         IMPORT_CFM_FUNCTION GetDblTime
  267.     ENDIF
  268.  
  269. ;
  270. ; pascal void SetEventMask(EventMask value)
  271. ;
  272.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  273.         Macro
  274.         _SetEventMask         &src=(sp)+
  275.             move.w            &src,$0144
  276.         EndM
  277.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  278.         IMPORT_CFM_FUNCTION SetEventMask
  279.     ENDIF
  280.  
  281. ;
  282. ; pascal OSErr PPostEvent(EventKind eventCode, UInt32 eventMsg, EvQElPtr *qEl)
  283. ;
  284.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  285.         _PPostEvent:    OPWORD    $A12F
  286.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  287.         IMPORT_CFM_FUNCTION PPostEvent
  288.     ENDIF
  289.  
  290. ;
  291. ; pascal Boolean GetNextEvent(EventMask eventMask, EventRecord *theEvent)
  292. ;
  293.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  294.         _GetNextEvent:    OPWORD    $A970
  295.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  296.         IMPORT_CFM_FUNCTION GetNextEvent
  297.     ENDIF
  298.  
  299. ;
  300. ; pascal Boolean WaitNextEvent(EventMask eventMask, EventRecord *theEvent, UInt32 sleep, RgnHandle mouseRgn)
  301. ;
  302.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  303.         _WaitNextEvent:    OPWORD    $A860
  304.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  305.         IMPORT_CFM_FUNCTION WaitNextEvent
  306.     ENDIF
  307.  
  308. ;
  309. ; pascal Boolean EventAvail(EventMask eventMask, EventRecord *theEvent)
  310. ;
  311.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  312.         _EventAvail:    OPWORD    $A971
  313.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  314.         IMPORT_CFM_FUNCTION EventAvail
  315.     ENDIF
  316.  
  317.  
  318. ;
  319. ; pascal OSErr PostEvent(EventKind eventNum, UInt32 eventMsg)
  320. ;
  321.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  322.         ; parameters:
  323.         ;    eventNum        => A0
  324.         ;    eventMsg        => D0
  325.         ; returns:
  326.         ;    OSErr           <= D0
  327.         _PostEvent:    OPWORD    $A02F
  328.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  329.         IMPORT_CFM_FUNCTION PostEvent
  330.     ENDIF
  331.  
  332. ;
  333. ; pascal Boolean OSEventAvail(EventMask mask, EventRecord *theEvent)
  334. ;
  335.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  336.         _OSEventAvail:    OPWORD    $A030
  337.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  338.         IMPORT_CFM_FUNCTION OSEventAvail
  339.     ENDIF
  340.  
  341. ;
  342. ; pascal Boolean GetOSEvent(EventMask mask, EventRecord *theEvent)
  343. ;
  344.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  345.         _GetOSEvent:    OPWORD    $A031
  346.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  347.         IMPORT_CFM_FUNCTION GetOSEvent
  348.     ENDIF
  349.  
  350. ;
  351. ; pascal void FlushEvents(EventMask whichMask, EventMask stopMask)
  352. ;
  353.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  354.         _FlushEvents:    OPWORD    $A032
  355.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  356.         IMPORT_CFM_FUNCTION FlushEvents
  357.     ENDIF
  358.  
  359. ;
  360. ; pascal void SystemClick(const EventRecord *theEvent, WindowPtr theWindow)
  361. ;
  362.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  363.         _SystemClick:    OPWORD    $A9B3
  364.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  365.         IMPORT_CFM_FUNCTION SystemClick
  366.     ENDIF
  367.  
  368. ;
  369. ; pascal void SystemTask(void )
  370. ;
  371.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  372.         _SystemTask:    OPWORD    $A9B4
  373.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  374.         IMPORT_CFM_FUNCTION SystemTask
  375.     ENDIF
  376.  
  377. ;
  378. ; pascal Boolean SystemEvent(const EventRecord *theEvent)
  379. ;
  380.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  381.         _SystemEvent:    OPWORD    $A9B2
  382.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  383.         IMPORT_CFM_FUNCTION SystemEvent
  384.     ENDIF
  385.  
  386.  
  387.  
  388.     ENDIF ; __EVENTS__ 
  389.  
  390.